package asdf.trial;

import java.util.HashMap;
import java.util.Map;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class GsonTest
{

    public static void main(String[] args)
    {
        Map<String, String> content = new HashMap<String, String>();
        for ( int i = 1; i < 4; i++ ) {
            content.put("param" + i, "value" + i);
        }
        Map<String, Object> msgMap = new HashMap<String, Object>();
        msgMap.put("title", "云歌");
        //		msgMap.put("content", content);
        msgMap.put("registrationId", "registration_id");
        msgMap.put("ewe", Integer.valueOf(23));
        String json = new Gson().toJson(msgMap);
        System.out.println(json);

        Map<String, String> m = new Gson().fromJson(json, new TypeToken<Map<String, String>>()
        {
        }.getType());
        System.out.println(m);

    }

}
